//
//  NSObject+MLXCrashProtect.m
//  Pods-MLXCrashProtectHandler
//
//  Created by SY on 2018/12/14.
//
#import <UIKit/UIKit.h>
#import "NSObject+MLXCrashProtect.h"
#import "MLXCrashProtectHandler.h"

@implementation NSObject (MLXCrashProtect)

#pragma mark --- KVCCrashProtect
-(void)setNilValueForKey:(NSString *)key{
    NSString *crashMessages = [NSString stringWithFormat:@"由于异常MLXCrashProtect:“终止应用程序, reason: '[%@  setNilValueForKey]: 不能设置为nil作为关键的价值 %@'",NSStringFromClass([self class]),key];
    [MLXCrashProtectHandler crashMessages:crashMessages];
}
- (void)setValue:(id)value forUndefinedKey:(NSString *)key{
    NSString *crashMessages = [NSString stringWithFormat:@"由于异常MLXCrashProtect:“终止应用程序, reason: '[%@  setValue:forUndefinedKey:]: 这个类没有键值coding-compliant关键: %@,value:%@'",NSStringFromClass([self class]),key,value];
   [MLXCrashProtectHandler crashMessages:crashMessages];
}
- (nullable id)valueForUndefinedKey:(NSString *)key{
    NSString *crashMessages = [NSString stringWithFormat:@"由于异常MLXCrashProtect:“终止应用程序 'NSUnknownKeyException', reason: '[%@  valueForUndefinedKey:]:这个类没有键值coding-compliant关键: %@",NSStringFromClass([self class]),key];
    [MLXCrashProtectHandler crashMessages:crashMessages];
    return @"key_null";
}
@end
